"""
模块概述：登录数据处理
创建时间：2021-3-2
更新时间：2021-3-15
"""
from flask import Flask, render_template
from flask import Flask, request, render_template, redirect, session
import pymysql
from table2 import table2
from zh_login import zh_app
from createWorkerInfo import createWI
from updateWorkerInfo import updateWI
from showWorkerInfo import showWI
from wqh_register import wqh_app
from searchWorkerInfo import searchWI
from shen_zhaopinfabu import shen_ZPFB
from shen_zhaopinxinxi import shen_ZPXX
from searchWorkerEvaluator import searchWE
from shen_evaluator import shen_E

app = Flask(__name__)
app.secret_key = 'jntm'
# 蓝图
app.register_blueprint(table2)
app.register_blueprint(zh_app)
app.register_blueprint(createWI)
app.register_blueprint(updateWI)
app.register_blueprint(showWI)
app.register_blueprint(wqh_app)
app.register_blueprint(searchWI)
app.register_blueprint(shen_ZPFB)
app.register_blueprint(shen_ZPXX)
app.register_blueprint(searchWE)
app.register_blueprint(shen_E)

# 主页
@app.route('/')
def index():
    session['user']='guest'
    session['isadminan']='guest'
    u=session.get('user')
    return render_template('homepage.html', u=u)


# 跳转评价页面
@app.route('/jump2')
def jump2():
    le = session.get('isadminan')
    u = session.get('user')
    if le == '企业':
        return render_template('table2.html',u=u)
    return render_template('homepage.html', u=u)


# 其他页面导航栏跳转主页
@app.route('/jump3')
def jump3():
    u = session.get('user')
    po = session.get('isadminan')
    if po == '企业':
        return render_template('homepage1.html', u=u)
    elif po == '员工':
        return render_template('homepage2.html', u=u)
    return render_template('homepage.html', u='guest')


if __name__ == '__main__':
    app.run()
